#!/bin/sh

ErrorNum=0
SuccessNum=0
for testfile in `ls in/*.cc`
do 
    ./cppgrammer ${testfile} -Tpng
    if [ $? -eq 0 ]; then
	SuccessNum=`expr $SuccessNum + 1`;
	#`rm -f ${testfile}.png`
    else 
	ErrorNum=`expr $ErrorNum + 1`;
    fi
    # 添加一些判断成功或者失败的信息， 如果失败， 打出输出， 如果成功则忽略输出。 可以先把输出导入到一个文件里， 
	#if failed , cat the file
    echo "+++++++++++++++++++++++++++++++++++++++++++++\n"
    echo $testfile "is tested\n"
done
echo "==========================================\n"
echo "+++++		Report            ++++++\n"
echo "==========================================\n"
echo "SuccessNum: " $SuccessNum
echo "ErrorNum:   " $ErrorNum

	
 
